<!DOCTYPE html>
<html lang="zh-CN" xmlns:th="http://www.thymeleaf.org">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>编辑学生 - 析码无界</title>
    <link rel="stylesheet" href="http://cdn.bootcss.com/bootstrap/3.3.4/css/bootstrap.min.css">
    <link rel="stylesheet" href="http://cdn.bootcss.com/font-awesome/4.7.0/css/font-awesome.min.css">
    <script src="http://cdn.bootcss.com/jquery/1.11.2/jquery.min.js"></script>
    <script src="http://cdn.bootcss.com/bootstrap/3.3.4/js/bootstrap.min.js"></script>
    <style>
        body {
            font-family: 'Microsoft YaHei', sans-serif;
            background-color: #f5f5f5;
            padding-top: 20px;
        }
        .panel {
            border: none;
            box-shadow: 0 2px 4px rgba(0,0,0,0.1);
            border-radius: 8px;
        }
        .panel-heading {
            background: linear-gradient(90deg, #667eea 0%, #764ba2 100%);
            color: white;
            border-radius: 8px 8px 0 0;
        }
        .btn-primary {
            background: linear-gradient(90deg, #667eea 0%, #764ba2 100%);
            border: none;
        }
    </style>
</head>
<body>
    <div class="container">
        <div class="panel panel-default">
            <div class="panel-heading">
                <h3 class="panel-title"><i class="fa fa-edit"></i> 编辑学生</h3>
            </div>
            <div class="panel-body">
                <div th:if="${error}" class="alert alert-danger" th:text="${error}"></div>
                
                <form th:action="@{/student/update}" method="post" class="form-horizontal">
                    <input type="hidden" th:value="${student?.id}" name="id"/>
                    
                    <div class="form-group">
                        <label class="col-sm-2 control-label">学号 <span style="color: red;">*</span></label>
                        <div class="col-sm-10">
                            <input type="text" class="form-control" name="studentNumber" 
                                   th:value="${student?.studentNumber}" required>
                        </div>
                    </div>
                    <div class="form-group">
                        <label class="col-sm-2 control-label">姓名 <span style="color: red;">*</span></label>
                        <div class="col-sm-10">
                            <input type="text" class="form-control" name="name" 
                                   th:value="${student?.name}" required>
                        </div>
                    </div>
                    <div class="form-group">
                        <label class="col-sm-2 control-label">性别</label>
                        <div class="col-sm-10">
                            <select class="form-control" name="gender">
                                <option value="">请选择</option>
                                <option value="男" th:selected="${student?.gender == '男'}">男</option>
                                <option value="女" th:selected="${student?.gender == '女'}">女</option>
                            </select>
                        </div>
                    </div>
                    <div class="form-group">
                        <label class="col-sm-2 control-label">专业</label>
                        <div class="col-sm-10">
                            <input type="text" class="form-control" name="major" 
                                   th:value="${student?.major}">
                        </div>
                    </div>
                    <div class="form-group">
                        <label class="col-sm-2 control-label">学院</label>
                        <div class="col-sm-10">
                            <input type="text" class="form-control" name="college" 
                                   th:value="${student?.college}">
                        </div>
                    </div>
                    <div class="form-group">
                        <label class="col-sm-2 control-label">班级</label>
                        <div class="col-sm-10">
                            <input type="text" class="form-control" name="className" 
                                   th:value="${student?.className}">
                        </div>
                    </div>
                    <div class="form-group">
                        <label class="col-sm-2 control-label">手机号</label>
                        <div class="col-sm-10">
                            <input type="text" class="form-control" name="phone" 
                                   th:value="${student?.phone}">
                        </div>
                    </div>
                    <div class="form-group">
                        <div class="col-sm-offset-2 col-sm-10">
                            <button type="submit" class="btn btn-primary">
                                <i class="fa fa-save"></i> 保存
                            </button>
                            <a th:href="@{/student/list}" class="btn btn-default">
                                <i class="fa fa-arrow-left"></i> 返回列表
                            </a>
                        </div>
                    </div>
                </form>
            </div>
        </div>
    </div>
</body>
</html>

